package com.cm.module.system.controller;

import com.cm.restful.ResponseBody;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author scott
 * @since 2018-12-17
 */
@RestController
@RequestMapping("/sys")
@Api(tags="用户登录")
@Slf4j
public class LoginController {

	@PostMapping("/login")
	public ResponseBody<?> login(@RequestParam("username") String username,
								 @RequestParam("password") String password) {
//		SysUser user = userService.getUserByName(username);
//		if(user==null) {
//			return new ResponseBean(200, "用户不存在！", JwtUtil.sign(username, user.getPassword()));
//		}
//		String passwordEncode = PasswordUtil.encrypt(username, password, user.getSalt());
//		if (passwordEncode.equals(user.getPassword())) {
//			return new ResponseBean(200, "Login success", JwtUtil.sign(username, user.getPassword()));
//		} else {
//			throw new UnauthorizedException();
//		}
		System.out.println("登录接口");
		return new ResponseBody();
	}

}